import {createSlice} from "@reduxjs/toolkit";


const ININT_STATE: number = 100;
export const countSlice = createSlice({
    name:'count',  //模块的名字，redux store默认可以拆分模块
    initialState:ININT_STATE,
    reducers:{
        incr(state:number){
            return state+1;
        },
        decr(state:number){
            return state-1; //不可变数据
        }
    }
})

export const  {incr,decr}=countSlice.actions;
export default countSlice.reducer;